<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue中样式绑定方式</title>
</head>
<body>
<div id="app">
    <!--内联样式使用方式-->
    <h1 :style="{color:'red', 'font-weight':200}" > {{ msg }} </h1>


    <h1 :style="[styleObj1, styleObj2]" > {{ msg }} </h1>
</div>


<script src="https://unpkg.com/vue/dist/vue.js"></script>

<script>
    var vm = new Vue({
        el: '#app',
        data: {
            msg: 'hello world',
            styleObj1: {color: 'red', 'font-style': 'italic'},
            styleObj2: {'font-weight': 200} //如果属性带有-，需要用单引号
        }
    })
</script>
</body>
</html>
